<form id="add-form" class="form-horizontal" role="form" data-toggle="validator" method="POST" action="">

    <div class="form-group ">
        <label class="control-label col-xs-12 col-sm-2"><span style="color: red;">*</span>项目名称:</label>
        <div class="col-xs-12 col-sm-3">
            <input class="form-control" id="name" name="row[name]" type="text"  placeholder="请填写项目名称" value="" data-rule="required">
        </div>

    </div>
    <div class="form-group ">
        <label class="control-label col-xs-12 col-sm-2"><span style="color: red;">*</span>五大产业:</label>
        <div class="col-xs-12 col-sm-3">
            <select class="form-control " name="row[five_industry_id]" id="five_industry_id" data-rule="required;">
                <option value="">请选择</option>
                {volist name="vo.item_rule.datasource" id="vv" }
                    <option value="{$key}">{$vv}</option>
                {/volist}
            </select>
        </div>

    </div>
    {volist name="list" id="vo" key="k"}

        <div class="form-group">
                <label class="control-label col-xs-12 col-sm-2">{if $vo.item_required == 1}<span style="color: red;">*</span>{/if}{$vo.item_label}:</label>
                <div class="col-xs-12 col-sm-6">
                    {switch name="vo.item_type" }
                        {case value="string"}
                            {if $vo.item_required == 1}
                                {if $vo.item_pending == 1}
                                <div class="input-group">
                                  <input class="form-control" id="{$vo.item_id}" name="row[{$vo.item_id}]" type="text"  placeholder="请填写{$vo.item_label}" value="" data-rule="required">
                                   <span class="input-group-addon">
                                    </span>
                                    <span class="msg-box n-right"></span>
                                </div>
                                {else/}
                                    <input class="form-control" id="{$vo.item_id}" name="row[{$vo.item_id}]" type="text"  placeholder="请填写{$vo.item_label}" value="" data-rule="required">
                                {/if}
                            {else/}
                                <input class="form-control" id="{$vo.item_id}" name="row[{$vo.item_id}]" type="text"  placeholder="请填写{$vo.item_label}" value="" >
                            {/if}
                        {/case}
                        {case value="price"}
                            {if $vo.item_required == 1}
                                {if $vo.item_pending == 1}
                                <div class="input-group">
                                  <input class="form-control " id="{$vo.item_id}" name="row[{$vo.item_id}]" type="text"  placeholder="请填写{$vo.item_label}" value="" data-rule="required" onkeyup="clearNoNum(this)">
                                   <span class="input-group-addon">
                                  <input type="checkbox" class="pending" data-id="{$vo.item_id}">待定
                                    </span>
                                    <span class="msg-box n-right"></span>
                                </div>
                                {else/}
                                    <input class="form-control " id="{$vo.item_id}" name="row[{$vo.item_id}]" type="text"  placeholder="请填写{$vo.item_label}" value="" data-rule="required" onkeyup="clearNoNum(this)">
                                {/if}
                            {else/}

                                <input class="form-control " id="{$vo.item_id}" name="row[{$vo.item_id}]" type="text"  placeholder="请填写{$vo.item_label}" value="" onkeyup="clearNoNum(this)">
                            {/if}

                        {/case}
                        {case value="datetime|date"}
                            {if $vo.item_required == 1}
                                {if $vo.item_pending == 1}
                                <div class="input-group">
                                  <input class="form-control datetimepicker"  type="text" id="{$vo.item_id}" name="row[{$vo.item_id}]"  data-date-format="YYYY-MM-DD" data-use-current="true" placeholder="请填写{$vo.item_label}" value="" data-rule="required">
                                   <span class="input-group-addon">
                                    <input type="checkbox" class="pending" data-id="{$vo.item_id}" >待定
                                    </span>
                                    <span class="msg-box n-right"></span>
                                </div>
                                {else/}
                                    <input class="form-control datetimepicker"  type="text" id="{$vo.item_id}" name="row[{$vo.item_id}]"  data-date-format="YYYY-MM-DD" data-use-current="true" placeholder="请填写{$vo.item_label}" value="" data-rule="required">
                                {/if}
                            {else/}
                                <input class="form-control datetimepicker"  type="text" id="{$vo.item_id}" name="row[{$vo.item_id}]"  data-date-format="YYYY-MM-DD" data-use-current="true" placeholder="请填写{$vo.item_label}" value="">
                            {/if}
                        {/case}
                        {case value="select"}
                            {if $vo.item_rule.multi=="1"}
                                <select class="form-control selectpicker" name="row[{$vo.item_id}][]" id="{$vo.item_id}" multiple title="请选择" {if $vo.item_required==1}data-rule="required;"{/if}>
                                    {volist name="vo.item_rule.datasource" id="vv" }
                                        <option value="{$key}">{$vv}</option>
                                    {/volist}
                                </select>
                            {else/}
                                {if isset($vo['item_rule']['is_relation']) && $vo['item_rule']['is_relation'] == "1" /}
                                <select class="form-control " style="width: 42%" name="row[{$vo.item_id}]" id="{$vo.item_id}" {if $vo.item_required==1}data-rule="required;"{/if}>
                                    <option value="">请选择</option>
                                    {volist name="vo.item_rule.datasource" id="vv" }
                                        <option value="{$key}">{$vv}</option>
                                    {/volist}
                                </select>
                                <input class="form-control" style="width:42%" name="row[{$vo.item_id}_relation]" id="{$vo.item_id}_relation"  value="">
                                <span id="{$vo.item_id}_addon"></span>
                                <span class="msg-box n-right"></span>
                                {else/}
                                <select class="form-control " name="row[{$vo.item_id}]" id="{$vo.item_id}" {if $vo.item_required==1}data-rule="required;"{/if}>
                                    <option value="">请选择</option>
                                    {volist name="vo.item_rule.datasource" id="vv" }
                                        <option value="{$key}">{$vv}</option>
                                    {/volist}
                                </select>
                                {/if}
                            {/if}
                        {/case}
                        {case value="radio"}
                            <select class="form-control" id="{$vo.item_id}"  name="row[{$vo.item_id}]" >
                                <option value="">请选择</option>
                                <option value="1">是</option>
                                <option value="0">否</option>
                            </select>
                        {/case}

                        {case value="text"}
                            <textarea  class="form-control "  id="{$vo.item_id}" name="row[{$vo.item_id}]" rows="{$vo.item_rule.row}" cols="50" placeholder="请填写{$vo.item_label}"></textarea>
                        {/case}
                    {/switch}
                </div>
        </div>
    {/volist}

    <div class="form-group layer-footer">
        <label class="control-label col-xs-12 col-sm-2"></label>
        <div class="col-xs-12 col-sm-8">
            <button type="submit" class="btn btn-success btn-embossed disabled">{:__('OK')}</button>
            <button type="reset" class="btn btn-default btn-embossed">{:__('Reset')}</button>
        </div>
    </div>
</form>
<script type="text/javascript">
    function clearNoNum(obj){
        obj.value = obj.value.replace(/[^\d.]/g,"");//清除"数字"和"."以外的字符
        obj.value = obj.value.replace(/^\./g,"");//验证第一个字符是数字而不是字符
        obj.value = obj.value.replace(/\.{2,}/g,".");//只保留第一个.清除多余的
        obj.value = obj.value.replace(".","$#$").replace(/\./g,"").replace("$#$",".");
        obj.value = obj.value.replace(/^(\-)*(\d+)\.(\d\d\d\d).*$/,'$1$2.$3');//只能输入两个小数
    }
</script>
 <div class="form-group ">
        <label class="control-label col-xs-12 col-sm-2"><span style="color: red;">*</span>五大产业:</label>
        <div class="col-xs-12 col-sm-3">
            <select class="form-control " name="row[five_industry_id]" id="five_industry_id" data-rule="required;">
                <option value="">请选择</option>
                {volist name="five_industry" id="vv" }
                    <option value="{$key}">{$vv}</option>
                {/volist}
            </select>
        </div>
        <label class="control-label col-xs-12 col-sm-2"><span style="color: red;">*</span>产业类别:</label>
        
        <div class="col-xs-12 col-sm-3">
            <select class="form-control selectpicker" name="row[industry_category_ids]" id="industry_category_ids" data-rule="required;" multiple>
                {volist name="industry_category" id="vv" }
                    <option value="{$key}">{$vv}</option>
                {/volist}
            </select>
        </div>

    </div>
    <div class="form-group ">
        <label class="control-label col-xs-12 col-sm-2"><span style="color: red;">*</span>提报部门:</label>
        <div class="col-xs-12 col-sm-3">
            <select class="form-control selectpicker" name="row[chargedep_ids]" id="chargedep_ids" data-rule="required;" multiple>
                <option value="">请选择</option>
                {volist name="chargedep" id="vv" }
                    <option value="{$key}">{$vv}</option>
                {/volist}
            </select>
        </div>
        {if $libary_id==1}
        <label class="control-label col-xs-12 col-sm-2"><span style="color: red;">*</span>拟落户街道:</label>
        <div class="col-xs-12 col-sm-3">
            <select class="form-control selectpicker" name="row[planned_street_ids]" id="planned_street_ids" data-rule="required;" multiple>
                <option value="-100">待定</option>
                {volist name="street" id="vv" }
                    <option value="{$key}">{$vv}</option>
                {/volist}
            </select>
            
        </div>
        {/if}
        {if $libary_id == 2}
        <label class="control-label col-xs-12 col-sm-2"><span style="color: red;">*</span>落户街道:</label>
        <div class="col-xs-12 col-sm-3">
            <select class="form-control selectpicker" name="row[planned_street_ids]" id="planned_street_ids" data-rule="required;" multiple>
                {volist name="street" id="vv" }
                    <option value="{$key}">{$vv}</option>
                {/volist}
            </select>
        </div>
        {/if}

    </div>
    <div class="form-group ">
        <label class="control-label col-xs-12 col-sm-2"><span style="color: red;">*</span>总投资(亿):</label>
        <div class="col-xs-12 col-sm-3">
            <div class="input-group">
              <input class="form-control " id="investment_total" name="row[investment_total]" type="text"  placeholder="请填写总投资额" value="" data-rule="required" onkeyup="clearNoNum(this)">
               <span class="input-group-addon">
              <input type="checkbox" class="pending" data-id="investment_total">待定
                </span>
                <!-- <span class="msg-box n-bottom"></span> -->
            </div>
        </div>
        <!-- <label class="control-label col-xs-12 col-sm-2"><span style="color: red;">*</span>内资(亿):</label> -->
        <div class="col-xs-12 col-sm-3">
            <div class="input-group">
                <span class="input-group-addon" id="basic-addon1">内资(亿):</span>
              <input class="form-control " id="domestic_capital" name="row[domestic_capital]" type="text"  placeholder="请填写内资金额" value="" data-rule="required" onkeyup="clearNoNum(this)">
               <span class="input-group-addon">
              <input type="checkbox" class="pending" data-id="domestic_capital">待定
                </span>
                <!-- <span class="msg-box n-bottom"></span> -->
            </div>
        </div>
        <!-- <label class="control-label col-xs-12 col-sm-2"><span style="color: red;">*</span>外资(万美元):</label> -->
        
        <div class="col-xs-12 col-sm-3">
            <div class="input-group">
                <span class="input-group-addon" id="basic-addon1">外资(万美元):</span>
              <input class="form-control " id="foreign_capital" name="row[foreign_capital]" type="text"  placeholder="请填写外资金额" value="" data-rule="required" onkeyup="clearNoNum(this)">
               <span class="input-group-addon">
              <input type="checkbox" class="pending" data-id="foreign_capital">待定
                </span>
                <!-- <span class="msg-box n-bottom"></span> -->
            </div>
        </div>

    </div>